import request from "@/utils/request";
import { LoginData } from "./type";

const api: string = "/authorize";
/**
 * 登录API
 *
 * @param data {LoginData}
 * @returns
 */
export function loginApi(data: LoginData): Result<string> {
  return request({
    url: `${api}/login`,
    method: "post",
    data: data,
  });
}

/**
 * 注销API
 */
export function logoutApi(): Result<void> {
  return request({
    url: `${api}/logout`,
    method: "get",
  });
}

/**
 * 获取验证码
 */
export function getCaptchaApi(key: string): Result<string> {
  return request({
    url: `${api}/getCaptcha/${key}`,
    method: "get",
  });
}
